{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1, 2], 3, 5]\n",
      "[6, 8]\n",
      "[[1, 2], 3, 5, [6, 8]]\n",
      "[[1], [1], [1], [1], [1]]\n",
      "[[1], [], [], [], []]\n"
     ]
    }
   ],
   "source": [
    "from copy import copy, deepcopy\n",
    "\n",
    "a = [[1,2],3,4]\n",
    "\n",
    "def f(a):\n",
    "    a[-1] = 5\n",
    "f(a) #改变\n",
    "print(a)\n",
    "\n",
    "b = [6,7]\n",
    "a.append(b)\n",
    "b[-1] = 8 #改变\n",
    "print((a[-1]))\n",
    "\n",
    "c = a[1:] \n",
    "c[0] = 9 #不改变\n",
    "print(a)\n",
    "\n",
    "d1 = [[]] * 5\n",
    "d1[0].append(1)\n",
    "print(d1)\n",
    "d2 = [[] for _ in range(5)]\n",
    "d2[0].append(1)\n",
    "print(d2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "class C(object):\n",
    "    def __init__(self, x=[]):\n",
    "        pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
